
import redis
 

def main():
    # 连接到本地Redis实例
    redis_host = '192.168.2.172'
    redis_port = 6379
    db_index = 1
    password = 'foobared'
    r = redis.StrictRedis(
        host=redis_host, 
        port=redis_port, 
        db=db_index,  # 数据库索引
        password=password,  # Redis密码
        decode_responses=True)
    
    # 查询数据
    key = 'celery-task-meta-0a6f00d6-5c03-4a57-b3f2-cdd5a65740e8'
    value = r.get(key)
    
    # 打印查询结果
    print(f"The value for '{key}' is {value}")
    return


if __name__ == "__main__":
    main()